#include "include/gtest.h"
#include "../Tool/include/ThreadPool.h"
#include "../Tool/include/Timer.h"

using namespace Tool;

TEST(ThreadPool, WaitAllFunctionality)
{
    ThreadPool pool(2);
    Timer timer;
    
    // 提交耗时任务
    for(int i = 0; i < 100; ++i)
    {
        pool.PostTask([i]() {
            std::cout << "thread id:" << std::this_thread::get_id() << "task index:" << i << std::endl;
            std::this_thread::sleep_for(std::chrono::milliseconds(100));
        });
    }

    pool.WaitAll();
}
